/*"关于我们"页的js逻辑代码
   作者：JackYan
   时间: 2015-5-12
* */

//轮播点击事件
var i=0;
$(".myBtnLeft").on("click",function(){
       var nowLeft=parseInt($("#myUL").css("left"));      
       $("#myUL").animate({left:nowLeft+130+"px"}); 
        $("#myUL").find("a").eq(i).removeClass("textYearSelect").addClass("textYearUnSelect")
        $("#myUL").find("a").eq(i-1).removeClass("textYearUnSelect").addClass("textYearSelect");
       i--;
       
});
$(".myBtnRight").on("click",function(){
	   var nowLeft=parseInt($("#myUL").css("left"));	   
       $("#myUL").animate({left:nowLeft-103+"px"});
       $("#myUL").find("a").eq(i).removeClass("textYearSelect").addClass("textYearUnSelect");
       $("#myUL").find("a").eq(i+1).removeClass("textYearUnSelect").addClass("textYearSelect")
       i++;
       
});

//热点地图部分的逻辑代码====
var myChart = echarts.init(document.getElementById('map'));
				option = {
				backgroundColor: '#232323',			    
				color: ['gold', 'aqua', 'lime'],
				tooltip: {
					trigger: 'item'
				},
				series: [{
					name: '好度科技有限公司 ',
					type: 'map',
					mapType: 'china',
					roam: false,					
					hoverable: true,
					itemStyle: {
						normal: {
							borderColor: 'rgba(100,149,237,1)',
							borderWidth: 0.5,
							label: { //显示地名
								show: true,
								textStyle: {
									color: 'white'
								}
							},
							areaStyle: {
								color: '#1b1b1b'
							}
						}
					},
					data: [{
						name: '天津'
					}, {
						name: '广州'
					}, {
						name: '厦门'
					}],
					geoCoord: {
						'厦门': [118.1689, 24.6478],
						'天津': [117.4219, 39.4189],
						'广州': [113.5107, 23.2196],
					    '北京': [116.4551,40.2539]
					},
					markLine: {
						smooth: true,
						symbol: ['none', 'none'],
						effect: {
							show: true,
							scaleSize: 1,
							period: 30,
							color: '#fff',
							shadowBlur: 10
						},
						itemStyle: {
							normal: {
								borderWidth: 1,
								lineStyle: {
									type: 'dotted',
									shadowBlur: 10,
									color:'#0cf4f7'
								}
							}
						},
						data: [
							[{
								name: '天津'
							}, {
								name: '厦门'
							}],
							[{
								name: '天津'
							}, {
								name: '广州'
							}],
							[{name:'天津'},{name:'厦门'}
							]
						]
					}
				}, {
					name: '天津总公司',
					type: 'map',
					mapType: 'china',
					itemStyle: {
						normal: {
							label: {
								show: true
							}
						},
						emphasis: {
							label: {
								show: true
							}							
						}
						
						
					},
					data: [{
						name: '天津',itemStyle:{normal:{color:'red'}}
					}],
					markPoint: {
						symbol: 'emptyCircle',
						effect: {
							show: true,
							shadowBlur: 0,
							scaleSize: 1,
						},
						itemStyle: {
							normal: {
								label: {
									show: true
								},
								color:'#00ff21'								
							}
						
							
						},
						data: [{
							name: '天津'
						}]
					},
				}, {
					name: '厦门分公司',
					type: 'map',
					mapType: 'china',
					itemStyle: {
						normal: {
							label: {
								show: true
							}
						},
						emphasis: {
							label: {
								show: true
							}
						}
					},
					data: [
					{name: '厦门'},
					{name:'福建',itemStyle:{normal:{color:'red'}}}
					
					],
					markPoint: {
						symbol: 'emptyCircle',
						effect: {
							show: true,
							shadowBlur: 0,
							scaleSize: 1,
						},
						itemStyle: {
							normal: {
								label: {
									show: true
								}
							},
							emphasis: {
								label: {
									position: 'top'
								}
							}
						},
						data: [{
							name: '厦门'
						}]
					},
				},
				{
					name: '北京分公司',
					type: 'map',
					mapType: 'china',
					itemStyle: {
						normal: {
							label: {
								show: true
							}
						},
						emphasis: {
							label: {
								show: true
							}
						}
					},
					data: [
					{name: '北京'},
					{name:'北京',itemStyle:{normal:{color:'yellow'}}}
					
					],
					markPoint: {
						symbol: 'emptyCircle',
						effect: {
							show: true,
							shadowBlur: 0,
							scaleSize: 1,
						},
						itemStyle: {
							normal: {
								label: {
									show: true
								}
							},
							emphasis: {
								label: {
									position: 'top'
								}
							}
						},
						data: [{
							name: '北京'
						}]
					},
				},
				{
					name: '广州分公司',
					type: 'map',
					mapType: 'china',
					itemStyle: {
						normal: {
							label: {
								show: true
							}
						},
						emphasis: {
							label: {
								show: true
							}
						}
					},
					data: [
					    {name: '广州'},
					    {name:'广东',itemStyle:{normal:{color:'lightGreen'}}}
					],
					markPoint: {
						symbol: 'emptyCircle',
						effect: {
							show: true,
							shadowBlur: 0,
							scaleSize: 1,
						},
						itemStyle: {
							normal: {
								label: {
									show: true
								}														
								
							}
							
						},
						data: [{
							name: '广州',itemStyle:{normal:{color:'green'}}
						}]
					},
				}]
			};
			myChart.setOption(option);
//End热点地图==============

var about = avalon.define("about", function(vm) {
	vm.mapWidth = 500;
	vm.mapHeight = 400;
	
	//根据屏幕尺寸换图片
	var slide1BigImg = "img/about/kapian-2014.2.png";
	var slide1SMImg = "img/mobile/about/kapian-2014.2.jpg";	
	vm.slide1Img = slide1BigImg;
	
	var slide2BigImg = "img/about/kapian-2014.7.png";
	var slide2SMImg = "img/mobile/about/kapian-2014.7.jpg";	
	vm.slide2Img = slide2BigImg;
	
	var slide3BigImg = "img/about/kapian-2014.11.png";
	var slide3SMImg = "img/mobile/about/kapian-2014.11.jpg";	
	vm.slide3Img = slide3BigImg;
	
	var slide4BigImg = "img/about/kapian-2014.12.png";
	var slide4SMImg = "img/mobile/about/kapian-2014.12.jpg";	
	vm.slide4Img = slide4BigImg;
	
	var slide5BigImg = "img/about/kapian-2015.3-.png";
	var slide5SMImg = "img/mobile/about/kapian-2015.3.jpg";	
	vm.slide5Img = slide5BigImg;
	
	var slide6BigImg = "img/about/kapian-2015今天.png";
	var slide6SMImg = "img/mobile/about/kapian-2015今天.jpg";	
	vm.slide6Img = slide6BigImg;
	
	//设置大图
	vm.setAboutImg=function(){
		var width = document.body.clientWidth;
		if(width < 768){
			vm.slide1Img = slide1SMImg;
			vm.slide2Img = slide2SMImg;
			vm.slide3Img = slide3SMImg;
			vm.slide4Img = slide4SMImg;
			vm.slide5Img = slide5SMImg;
			vm.slide6Img = slide6SMImg;$(".carousel-indicators").css("display","none");
		}
		else{
			vm.slide1Img = slide1BigImg;
			vm.slide2Img = slide2BigImg;
			vm.slide3Img = slide3BigImg;
			vm.slide4Img = slide4BigImg;
			vm.slide5Img = slide5BigImg;
			vm.slide6Img = slide6BigImg;
		}
			
	};
    
	vm.setAboutImg();
	
});

about.$watch('resize',resizeMap);
function resizeMap(){
		var width = document.getElementById('mapWarp').clientWidth;
		if(width > 500)
			width = 500;
		about.mapWidth = width;
		about.mapHeight = width * 0.8;
		myChart.resize();
		
	about.setAboutImg();
};
setTimeout(resizeMap,50);
avalon.scan();